
Import target

Class PythonTarget Extends Target

	Function IsValid()
		If FileType( "python" )<>FILETYPE_DIR Return False

		Return True
	End
	
	Method Begin()
		ENV_TARGET="python"
		ENV_LANG="py"
		_trans=New PyTranslator
	End
	
	Method Config$()
		Local config:=New StringStack
		For Local kv:=Eachin Env
			config.Push "CFG_"+kv.Key+" = ~q"+kv.Value.Replace("~q", "")+"~q"
		Next
		Return config.Join( "~n" )
	End
	
	Method MakeTarget()
			
		CreateDataDir "data"
	
		Local main$=LoadString( "main.py" )
		
		main=ReplaceBlock( main,"TRANSCODE",transCode,"~n#" )
		main=ReplaceBlock( main,"CONFIG",Config(),"~n#"  )
		
		SaveString main,"main.py"
		
		If OPT_ACTION>=ACTION_RUN
			Execute "main.py"	
		Endif
	
	End

End